package com.hd.abc.books.web.contyllry;

import com.hd.abc.books.common.ResponseResult;
import com.hd.abc.books.common.ResultTable;
import com.hd.abc.books.entity.book;
import com.hd.abc.books.servlet.ser;
import com.sun.org.apache.regexp.internal.RE;
import org.apache.ibatis.annotations.ResultType;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/book")
public class bookscon {
    @Resource
    private ser ser;

    @RequestMapping("/page")
    public ResultTable page(@RequestParam(defaultValue = "1") int page,
                            @RequestParam(defaultValue = "5") int limit,
                            String bookname,
                            @RequestParam(defaultValue = "0") double a,
                            @RequestParam(defaultValue = "0") double b){
        return ser.getdata(page,limit,bookname,a,b);
    }
    @RequestMapping("/select")
    public ResultTable select(String bookname,
                              @RequestParam(defaultValue = "0") double a,
                              @RequestParam(defaultValue = "0") double b) {
        return null;
    }
    @RequestMapping("/del")
    private ResponseResult del(int id){
        return ser.del(id);
    }
    @RequestMapping("/add")
    private ResponseResult add(book book){
        return ser.adddata(book);
    }
}
